//
//  QSCollectionCell.m
//  PigMarket
//
//  Created by 张敬 on 2019/8/13.
//  Copyright © 2019年 pigmarket.oc. All rights reserved.
//

#import "QSCollectionCell.h"

@interface QSCollectionCell()

/**
 iconImg
 */
@property (nonatomic , strong) UIImageView *iconImgView;

/**
 标题
 */
@property (nonatomic , strong) UILabel *titleLab;

/**
 人民日报
 */
@property (nonatomic , strong) UILabel *sourceLab;

/**
 1小时前
 */
@property (nonatomic , strong) UILabel *timeLab;

/**
1204已读
 */
@property (nonatomic , strong) UILabel *readingLab;

@end


@implementation QSCollectionCell


#pragma mark - lifecycle methods

- (void)setupUI
{
    // 添加子控件
    [self.contentView addSubview:self.iconImgView];
    [self.contentView addSubview:self.sourceLab];
    [self.contentView addSubview:self.titleLab];
    [self.contentView addSubview:self.timeLab];
    [self.contentView addSubview:self.readingLab];
    
}

- (void)setupLayout
{
    {
        _iconImgView.size = CGSizeMake(117, 78);
        _iconImgView.mj_y = 15;
        _iconImgView.mj_x = KScreenWidth - _iconImgView.width - 15;
    }
    
    {
        _titleLab.size = CGSizeMake(_iconImgView.left - 37, 52);
        _titleLab.mj_x = 17;
        _titleLab.mj_y = 15;
    }
    
    {
        _sourceLab.mj_x = 15;
        _sourceLab.mj_y = _timeLab.mj_y = _readingLab.mj_y = _titleLab.bottom + 9;
        _timeLab.mj_x = _sourceLab.right + 15;
        _readingLab.mj_x = _timeLab.right + 15;
    }
    
}

#pragma mark - networking methods
#pragma mark - response methods
#pragma mark - public methods
#pragma mark - tableview.delegate methods
#pragma mark - tableview.datasource methods
#pragma mark - setter methods
#pragma mark - getter methods

- (UIImageView *)iconImgView {
    if (!_iconImgView) {
        _iconImgView = [[UIImageView alloc] init];
        _iconImgView.backgroundColor = KBlueColor;
    }
    return _iconImgView;
}

- (UILabel *)titleLab {
    if (!_titleLab) {
        _titleLab = [[UILabel alloc] init];
        _titleLab.textColor = UIColorFromRGB(0x343434);
        _titleLab.font = mFont(17);
        _titleLab.text = @"青贮饲料可保存青绿饲料的大部分营养！";
        _titleLab.numberOfLines = 0;
    }
    return _titleLab;
}

- (UILabel *)sourceLab {
    if (!_sourceLab) {
        _sourceLab = [[UILabel alloc] init];
        _sourceLab.textColor = UIColorFromRGB(0x8C8C8C);
        _sourceLab.font = mFont(12);
        _sourceLab.text = @"人民日报";
        _sourceLab.size = CGSizeMake(KScreenWidth, 44);
        [_sourceLab sizeToFit];
    }
    return _sourceLab;
}


- (UILabel *)timeLab {
    if (!_timeLab) {
        _timeLab = [[UILabel alloc] init];
        _timeLab.textColor = UIColorFromRGB(0x8C8C8C);
        _timeLab.font = mFont(12);
        _timeLab.text = @"1小时前";
        _timeLab.size = CGSizeMake(KScreenWidth, 44);
        [_timeLab sizeToFit];

    }
    return _timeLab;
}


- (UILabel *)readingLab {
    if (!_readingLab) {
        _readingLab = [[UILabel alloc] init];
        _readingLab.textColor = UIColorFromRGB(0x8C8C8C);
        _readingLab.font = mFont(12);
        _readingLab.text = @"1204已读";
        _readingLab.size = CGSizeMake(KScreenWidth, 44);
        [_readingLab sizeToFit];

    }
    return _readingLab;
}


@end
